#Author:SSun
# -*- codeing = utf-8 -*-
# @Time :2020/8/27 20:08
# @Author:孙孙
# @Site : 
# @File : run_spider.py
# @Sortware: PyCharm


from spider_joke import Joke_spider
import time
import logging
import random





def run():
    joke = Joke_spider()
    htmls = joke.ask_url()

    # for html in htmls:
    #     texts = joke.parse_html(html)
    #     for text in texts:
    #         print(text)
    # for url in joke.urls():
    #     print(url)
    for html in htmls:
        joke.write_db(html)
    # joke.readdb()
    # num = random.randint(1800,2000)
    # time.sleep(num)
    logging.info('爬取成功')


if __name__ == '__main__':
    run()


